package com.shujia.mapredue;

import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo5NodeManager {
    public static void main(String[] args) throws Exception {

        //启动server ，绑定一个端口
        ServerSocket serverSocket = new ServerSocket(8888);
        System.out.println("服务的已启动。。");


        Socket accept = serverSocket.accept();

        //获取输入流
        InputStream inputStream = accept.getInputStream();

        //对象输入流
        ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);

        //d获取客户端发送过来的task, 强制转换成thread
        Thread task = (Thread) objectInputStream.readObject();

        //启动客户端发送过来的task
        task.start();


    }
}
